package GUI;

import java.awt.Graphics;
import java.awt.event.MouseListener;

import javax.swing.JPanel;

public class PanelHolder extends JPanel
{
	private int x1,y1;
	public boolean horizontal_flag=false,vertical_flag=false,NE_flag=false,SE_flag=false,NW_flag=false,SW_flag=false;
	Graphics draw;
	public PanelHolder(int X1,int Y1)
	{
		super();
		x1=X1;
		y1=Y1;
	}
	public int getOffsetX()
	{
		return x1;
	}
	public int getOffsetY()
	{
		return y1;
	}
	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		draw=g;
		drawL();
	}
	
	public void drawL()
	{
		if(horizontal_flag==true)
		{
			if(vertical_flag==false)
			draw.drawLine(x1, y1+(this.getHeight()/2), x1+this.getWidth(), y1+(this.getHeight()/2));
			else
			{
				draw.drawLine(x1, y1+(this.getHeight()/2), x1+20, y1+(this.getHeight()/2));
				draw.drawArc(x1+20, y1-10+(this.getHeight()/2), 20,20,0,180);
				draw.drawLine(x1+40, y1+(this.getHeight()/2), x1+this.getWidth(), y1+(this.getHeight()/2));
			}
		}
		if(vertical_flag==true)
		{
		    draw.drawLine(x1+(this.getWidth()/2), y1, x1+(this.getWidth()/2), y1+(this.getHeight()));	
		}
		if(NE_flag==true)
		{
			draw.drawLine(x1, y1+(this.getHeight()/2), x1+(this.getWidth()/2), y1+(this.getHeight()/2));
			draw.drawLine(x1+(this.getWidth()/2), y1+(this.getHeight()/2), x1+(this.getWidth()/2), y1+(this.getHeight()));			
		}
		if(SE_flag==true)
		{
			draw.drawLine(x1, y1+(this.getHeight()/2), x1+(this.getWidth()/2), y1+(this.getHeight()/2));
			draw.drawLine(x1+(this.getWidth()/2), y1+(this.getHeight()/2), x1+(this.getWidth()/2), y1);			
		}
		if(NW_flag==true)
		{
			draw.drawLine(x1, y1+(this.getHeight()/2), x1+(this.getWidth()/2), y1+(this.getHeight()/2));
			draw.drawLine(x1+(this.getWidth()/2), y1+(this.getHeight()/2), x1+(this.getWidth()/2), y1+(this.getHeight()));			
		}
		if(SW_flag==true)
		{
			draw.drawLine(x1+(this.getWidth()/2), y1, x1+(this.getWidth()/2), y1+(this.getHeight()/2));
			draw.drawLine(x1+(this.getWidth()/2), y1+(this.getHeight()/2), x1+(this.getWidth()), y1+(this.getHeight()/2));			
		}
		
		updateUI();
	}

}
